package com.aistar.service.impl;

import com.aistar.mapper.ProductSpecMapper;
import com.aistar.pojo.ProductSpec;
import com.aistar.pojo.ProductSpecExample;
import com.aistar.service.ProductSpecService;
import com.aistar.util.ServerResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductSpecServiceImpl implements ProductSpecService {
    @Autowired
    ProductSpecMapper productSpecMapper;
    @Override
    public ServerResponse getByProId(Integer productId) {
        ProductSpecExample productSpecExample = new ProductSpecExample();
        productSpecExample.createCriteria().andSpecStatusEqualTo(1)
                .andProductIdEqualTo(productId);
        List<ProductSpec> productSpecList = productSpecMapper.selectByExample(productSpecExample);
        if (productSpecList !=null && productSpecList.size()>0)
            return ServerResponse.getDataSuccess(productSpecList.get(0));
        return ServerResponse.getDataFailed("该商品没有图片");
    }

    @Override
    public ServerResponse getByProductId(Integer proId) {
        return null;
    }

    @Override
    public ServerResponse save(ProductSpec productSpec) {
        return null;
    }

    @Override
    public ServerResponse modifyStatus(ProductSpec productSpec) {
        return null;
    }

    @Override
    public ServerResponse modify(ProductSpec productSpec) {
        return null;
    }

    @Override
    public ServerResponse getById(Integer id) {
        return null;
    }

    @Override
    public ServerResponse getAll() {
        return null;
    }
}
